Unit NetimoMinimize;

Interface
Uses
  Classes, sysUtils, Windows,
  WindowHack;

Type
  TNetimoMinimize = Class(TThread)
  Private
  Protected
    Procedure Execute; Override;
  Public

  End;

Implementation

{ TNetimoMinimize }

Procedure TNetimoMinimize.Execute;
Var
  FWinHack: TWindowHack;
  FStartTime: LongInt;
  fTimeOut,fDone: Boolean;
Begin

  self.FreeOnTerminate := True;

  fDone := false;
  fTimeOut := False;
  Try
    Try
      FWinHack := TWindowHack.Create(Nil);
      FStartTime := GetTickCount;
      While (Not Terminated) And (fDone = False) And (fTimeOut = false) Do
      Begin
        FWinHack.open;
        fDone := FWinHack.MinimizeWindow('ThunderRT6FormDC', 'Greenware;Log-in');
        If fDone Then break;

        If (GetTickCount - FStartTime) >= (1000 * 8) Then
        Begin
          fTimeOut := True;
          break;
        End;

        WaitforSingleObject(self.handle, 20);
      End; // while

    Except
      On e: Exception Do
      Begin
      End;
    End; // try/except
  Finally
    FWinHack.Free;
  End;
End;

End.

